<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <title>Document</title>
    <script src="../vue.js"></script>
    <style>
      .box {
        width: 100px;
        height: 100px;
      }
      .red {
        background-color: red;
      }
      .green {
        background-color: green;
      }
      .border {
        border: 1px solid #000;
      }
    </style>
  </head>

  <body>
    <div id="app">
      <!-- 字符串绑定 -->
      <div class="box" :class="isRed ? 'red':'green'"></div>
      <!-- 对象绑定 -->
      <div :class="{red:false,border:true,box:true,green:true}"></div>
      <!-- 数组绑定 -->
      <div :class="['green','border','box']"></div>
      <div></div>
    </div>
    <script>
      const vm = new Vue({
        el: "#app",
        data() {
          return {
            isRed: true,
          };
        },
      });
    </script>
  </body>
</html>
